package user;

import book.BookList;
import operation.*;

import java.util.Scanner;

public class NormalUser extends User{
    IOperation[] operations = new IOperation[]{
            new ExitOperation(),
            new FindOperation(),
            new BorrowOperation(),
            new ReturnOpration(),
            new ShowOperation(),
    };
    @Override
    public int menu() {
        System.out.println("***************");
        System.out.println("欢迎你 " + getName());
        System.out.println("***1. 查找书***");
        System.out.println("***2. 借阅书***");
        System.out.println("***3. 归还书***");
        System.out.println("***4. 显示书***");
        System.out.println("***0. 退出系统*");
        System.out.println("***************");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的选项：");
        int choice = sc.nextInt();
        return choice;
    }

    @Override
    public void doOperation(int choice, BookList bookList) {
        operations[choice].work(bookList);
    }

    public NormalUser(String name) {
        super(name);
    }


}
